﻿namespace Guia.Elements.PatternServants
{
    using System;
    using System.Windows.Automation;

    /// <summary>
    /// Represents the implementation of the Invoke-Pattern.
    /// </summary>
    public class InvokeImpl : AbstractPatternServant, IInvoke
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="InvokeImpl"/> class. 
        /// </summary>
        /// <param name="uiElement">
        /// The UiElement for which the servant provides functionality.
        /// </param>
        public InvokeImpl(UiElement uiElement)
            : base(uiElement)
        {
        }

        #region IInvoke Members

        /// <summary>
        /// Invokes the UiElement.
        /// </summary>
        public void Invoke()
        {
            this.UiElement.GetPattern<InvokePattern>().Invoke();
        }

        #endregion
    }
}
